package com.lmscn.lms.api.model;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;

public class CourseCount extends Model<CourseCount> {
	public static final CourseCount dao = new CourseCount();
	public CourseCount findByCourseId(Long courseId){
		return dao.findFirst("select * from t_course_count where course_id = ?", courseId);
	}
	
	public int addStudyNumByCourseId(Long courseId, int addedNum) {
		return Db.update("update t_course_count set study_num = study_num + ? where id = ?", addedNum, courseId);
	}
}
